﻿<head>

<link rel="stylesheet" type="text/css" href="/public/css/flexigrid/flexigrid/flexigrid.css">
<link rel="stylesheet" media="screen" type="text/css" href="/public/css/admin/category/style.css" />
<link rel="stylesheet" href="/public/css/admin/category/nyroModal-1.3.0/styles/nyroModal.css" type="text/css" media="screen" />
<script type="text/javascript" src="/public/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/public/js/jquery-1.2.3.pack.js"></script>
<script type="text/javascript" src="/public/js/flexigrid.js"></script>
<script type="text/javascript" src="/public/js/jquery.simple.tree.js"></script>
<script src="/public/css/admin/category/nyroModal-1.3.0/js/jquery.nyroModal-1.3.0.pack.js"></script> 

<script type="text/javascript">   
	$(document).ready(function(){ 
		$("#tablesupplier").flexigrid( 
		{
			url:'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/supplier/list', 
			dataType: 'json',
			colModel : [
				{display: 'ID', name : 's_id', width : 40, sortable : true, align: 'center'},
				{display: 'Nhà sản xuất', name : 's_ten', width : 180, sortable : true, align: 'center'},
				{display: 'Xuất xứ', name : 's_diachi', width : 120, sortable : true, align: 'center'},
				{display: 'Trang chủ', name : 's_link', width : 130, sortable : true, align: 'center'},
				{display: 'Avatar', name : 's_anh', width : 80, sortable : true, align: 'center'}
				],
			buttons : [
				{name: 'Add', bclass: 'add',onpress : test},
				{name: 'Delete', bclass: 'delete',onpress : test},
				{separator: true}
				], 
			searchitems : [
				{display: 'SID', name : 'o_id'},
				{display: 'Tên Hãng', name : 's_ten', isdefault: true}
				],
			title:'Hãng Sản Xuất',
			usepager: true,
			userRp:true,
			singleSelect: true,
			showTableToggleBtn: true,
			rp:8,
			width:700,
			height:200,
		}
		);
			
		function test(com,grid) 
			{
				if (com=='Delete')
					{

					}
				else if (com=='Add')
					{
						//alert('Add New Item');
						$.nyroModalManual({
							url: 'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/supplier/add',
							width: 500, // default Width If null, will be calculate automatically
							height: 500, // default Height If null, will be calculate automatically
							minWidth: null, // Minimum width
							minHeight: null, // Minimum height
						});	
					}			
			}
			

	});	
</script>

<script type="text/javascript">        
	$(document).ready(function(){	
		
		$(".edit").click(function(){ 
			supplierID = $(this).parent("div").parent("td").attr("id");
			//alert('Edit Item'+ supplierID);	
			$.nyroModalManual({
				url: 'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/supplier/update?id='+supplierID,
				width: 500, // default Width If null, will be calculate automatically
				height: 500, // default Height If null, will be calculate automatically
				minWidth: null, // Minimum width
				minHeight: null, // Minimum height
			});	
		});
	});
</script>
</head>
<?php 
	$db = Zend_Registry::get('db');
	$table = 'supplier';
	$select = $db->select()->from($table);
	$suppliers = $db->query($select)->fetchAll();
?>

 
<table id="tablesupplier">

	<?php //echo $this->partialLoop('supplier/_supplier.phtml',$suppliers); ?>
</table>	


<style>
	
	.flexigrid div.fbutton .add
		{
			background: url(/public/css/flexigrid/images/add.png) no-repeat center left;
		}	

	.flexigrid div.fbutton .delete
		{
			background: url(/public/css/flexigrid/images/close.png) no-repeat center left;
		}	

</style>